﻿<Page
    x:Class="FilePickerExample.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:FilePickerExample"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="200"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="100"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <StackPanel Orientation="Vertical"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center">
            <Button x:Name="PickButton" 
                    Content="Pick a File" 
                    HorizontalAlignment="Center" 
                    VerticalAlignment="Center"
                    Width="130"
                    Margin="3"
                    Click="PickButton_OnClick"/>
            <Button x:Name="LastButton" 
                    Content="Open Last File" 
                    HorizontalAlignment="Center" 
                    VerticalAlignment="Center"
                    Width="130"
                    Margin="3"
                    Click="LastButton_OnClick"/>
        </StackPanel>

        <ListView x:Name="RecentFiles" 
                  Grid.Column="0"
                  Grid.Row="1"
                  SelectionChanged="RecentFiles_OnSelectionChanged">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Name}" TextTrimming="WordEllipsis"/>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
        <TextBlock x:Name="TextDisplay" 
                   Grid.Row="1"
                   Grid.Column="1"
                   Margin="10"
                   HorizontalAlignment="Stretch"
                   VerticalAlignment="Stretch"
                   TextWrapping="Wrap"/>
    </Grid>
</Page>
